package com.test.day04.outputStream;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

/**
 * @program: 一次写入多个字节的方法
 * @author: luhd
 * @create: 2021-08-05
 */
public class Demo02OutputStream {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("b.txt");
        fos.write(49);
        fos.write(48);
        fos.write(48);
        byte [] btes = {65,66,67,68,69}; //ABCDE
        //byte [] btes = {-65,-66,-67,68,69};
        //fos.write(btes);
        fos.write(btes,1,2); //BC
        byte[] bytes2 = "你好".getBytes();
        System.out.println(Arrays.toString(bytes2)); // [-28, -67, -96, -27, -91, -67]
        fos.write(bytes2); //你好
        fos.close();
    }
}
